package com.beemans.common.app.ui.fragments

import android.os.Bundle
import android.util.Log
import android.view.View
import com.beemans.common.app.R
import com.beemans.common.app.databinding.FragmentExposureBinding
import com.beemans.common.app.ui.base.BaseFragment
import com.beemans.common.ext.setPageBack
import com.tiamosu.databinding.delegate.lazyDataBindingOrNull
import com.tiamosu.databinding.page.DataBindingConfig

/**
 * @author tiamosu
 * @date 2022/3/20
 */
class ExposureFragment : BaseFragment() {
    private val dataBinding: FragmentExposureBinding? by lazyDataBindingOrNull { }

    private var title: String? = null

    override fun getDataBindingConfig(): DataBindingConfig {
        return DataBindingConfig(R.layout.fragment_exposure)
    }

    override fun initParameters(bundle: Bundle?) {
        title = getString(MainFragment.PARAM_TITLE)
    }

    override fun initView(rootView: View?) {
        dataBinding?.exposureTitleBar?.setTvTitle { text = title }
    }

    override fun initEvent() {
        dataBinding?.exposureTitleBar?.setPageBack { }

        dataBinding?.exposureExposureLayout1?.setExposureCallback {
            Log.e("susu", "ExposureLayout1 --- isLocalVisible:$it")
        }

        dataBinding?.exposureExposureLayout2?.setTimeLimit(2000)
        dataBinding?.exposureExposureLayout2?.setShowRatio(0.95f)
        dataBinding?.exposureExposureLayout2?.setExposureCallback {
            Log.e("susu", "ExposureLayout2 --- isLocalVisible:$it")
        }
    }

    override fun doBusiness() {
    }
}